/**
* Event services
*/
app.factory("materialServices", function($http, toolsServices) {
	console.info("start to register materialServices");
	var materials = [];
	return {
		allMaterials: function(callback) {
			console.log('materialServices - get all materials');
			$http.post(app.servicebase, { "service" : "getMaterials" }).
			success(function(data, status) 
			{
				console.info("getMaterials - call success"); 
				if(data.isFailed == true)
				{
					throw data.exception;
				}
				materials = data.response;
				callback(data);
			})
			.
			error(function(data, status) 
			{
				console.error("getMaterials - call failed"); 	
				throw status + ' : ' + data;		
			});
		}
	};
});